home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / Sound.h < prev    next >
Text File  |  1995-08-15  |  23KB  |  665 lines

  1. /*
  2.      File:        Sound.h
  3.  
  4.      Contains:    Sound Manager Interfaces.
  5.  
  6.      Version:    Technology:    Sound Manager 3.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __SOUND__
  21. #define __SOUND__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __COMPONENTS__
  30. #include <Components.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33.  
  34. #ifndef __MIXEDMODE__
  35. #include <MixedMode.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT_SUPPORTED
  47. #pragma import on
  48. #endif
  49.  
  50.  
  51.  
  52. /*
  53.                         * * *  N O T E  * * *
  54.  
  55.     This file has been updated to include Sound Manager 3.1 interfaces.
  56.  
  57.     Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
  58.     that originally shipped with the PowerMacs. These missing functions and the
  59.     new 3.1 interfaces have been released in the SoundLib library for PowerPC
  60.     developers to link with. The runtime library for these functions are
  61.     installed by Sound Manager 3.1. The following functions are found in SoundLib.
  62.  
  63.         GetCompressionInfo, GetSoundPreference, SetSoundPreference,
  64.         UnsignedFixedMulDiv, SndGetInfo, SndSetInfo
  65. */
  66. /*
  67.     Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  68.  
  69.     These items are no longer defined, but appear here so that someone
  70.     searching the interfaces might find them. If you are using one of these
  71.     items, you must change your code to support the Sound Manager.
  72.  
  73.         swMode, ftMode, ffMode
  74.         FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  75.         SndCompletionProcPtr
  76.         StartSound, StopSound, SoundDone
  77. */
  78.  
  79.  
  80. #define twelfthRootTwo            1.05946309434
  81. enum {
  82.     soundListRsrc                = 'snd ',                        /*Resource type used by Sound Manager*/
  83.     rate44khz                    = 0xAC440000L,                    /*44100.00000 in fixed-point*/
  84.     rate22050hz                    = 0x56220000L,                    /*22050.00000 in fixed-point*/
  85.     rate22khz                    = 0x56EE8BA3L,                    /*22254.54545 in fixed-point*/
  86.     rate11khz                    = 0x2B7745D1L,                    /*11127.27273 in fixed-point*/
  87.     rate11025hz                    = 0x2B110000,                    /*11025.00000 in fixed-point*/
  88. /*synthesizer numbers for SndNewChannel*/
  89.     squareWaveSynth                = 1,                            /*square wave synthesizer*/
  90.     waveTableSynth                = 3,                            /*wave table synthesizer*/
  91.     sampledSynth                = 5,                            /*sampled sound synthesizer*/
  92. /*old Sound Manager MACE synthesizer numbers*/
  93.     MACE3snthID                    = 11,
  94.     MACE6snthID                    = 13,
  95.     kMiddleC                    = 60,                            /*MIDI note value for middle C*/
  96.     kSimpleBeepID                = 1,                            /*reserved resource ID for Simple Beep*/
  97.     kFullVolume                    = 0x0100,                        /*1.0, setting for full hardware output volume*/
  98.     kNoVolume                    = 0,                            /*setting for no sound volume*/
  99. /*command numbers for SndDoCommand and SndDoImmediate*/
  100.     nullCmd                        = 0,
  101.     initCmd                        = 1,
  102.     freeCmd                        = 2,
  103.     quietCmd                    = 3,
  104.     flushCmd                    = 4,
  105.     reInitCmd                    = 5,
  106.     waitCmd                        = 10,
  107.     pauseCmd                    = 11,
  108.     resumeCmd                    = 12,
  109.     callBackCmd                    = 13
  110. };
  111.  
  112. enum {
  113.     syncCmd                        = 14,
  114.     availableCmd                = 24,
  115.     versionCmd                    = 25,
  116.     totalLoadCmd                = 26,
  117.     loadCmd                        = 27,
  118.     freqDurationCmd                = 40,
  119.     restCmd                        = 41,
  120.     freqCmd                        = 42,
  121.     ampCmd                        = 43,
  122.     timbreCmd                    = 44,
  123.     getAmpCmd                    = 45,
  124.     volumeCmd                    = 46,                            /*sound manager 3.0 or later only*/
  125.     getVolumeCmd                = 47,                            /*sound manager 3.0 or later only*/
  126.     waveTableCmd                = 60,
  127.     phaseCmd                    = 61
  128. };
  129.  
  130. enum {
  131.     soundCmd                    = 80,
  132.     bufferCmd                    = 81,
  133.     rateCmd                        = 82,
  134.     continueCmd                    = 83,
  135.     doubleBufferCmd                = 84,
  136.     getRateCmd                    = 85,
  137.     rateMultiplierCmd            = 86,
  138.     getRateMultiplierCmd        = 87,
  139.     sizeCmd                        = 90,
  140.     convertCmd                    = 91,
  141.     stdQLength                    = 128,
  142.     dataOffsetFlag                = 0x8000
  143. };
  144.  
  145. /*channel initialization parameters*/
  146. #if OLDROUTINENAMES
  147. enum {
  148.     waveInitChannelMask            = 0x07,
  149.     waveInitChannel0            = 0x04,                            /*wave table only, Sound Manager 2.0 and earlier*/
  150.     waveInitChannel1            = 0x05,                            /*wave table only, Sound Manager 2.0 and earlier*/
  151.     waveInitChannel2            = 0x06,                            /*wave table only, Sound Manager 2.0 and earlier*/
  152.     waveInitChannel3            = 0x07,                            /*wave table only, Sound Manager 2.0 and earlier*/
  153.     initChan0                    = waveInitChannel0,                /*obsolete spelling*/
  154.     initChan1                    = waveInitChannel1,                /*obsolete spelling*/
  155.     initChan2                    = waveInitChannel2,                /*obsolete spelling*/
  156.     initChan3                    = waveInitChannel3                /*obsolete spelling*/
  157. };
  158.  
  159. #endif
  160. enum {
  161.     initChanLeft                = 0x0002,                        /*left stereo channel*/
  162.     initChanRight                = 0x0003,                        /*right stereo channel*/
  163.     initNoInterp                = 0x0004,                        /*no linear interpolation*/
  164.     initNoDrop                    = 0x0008,                        /*no drop-sample conversion*/
  165.     initMono                    = 0x0080,                        /*monophonic channel*/
  166.     initStereo                    = 0x00C0,                        /*stereo channel*/
  167.     initMACE3                    = 0x0300,                        /*MACE 3:1*/
  168.     initMACE6                    = 0x0400,                        /*MACE 6:1*/
  169.     initPanMask                    = 0x0003,                        /*mask for right/left pan values*/
  170.     initSRateMask                = 0x0030,                        /*mask for sample rate values*/
  171.     initStereoMask                = 0x00C0,                        /*mask for mono/stereo values*/
  172.     initCompMask                = 0xFF00,                        /*mask for compression IDs*/
  173.     kUseOptionalOutputDevice    = -1,                            /*only for Sound Manager 3.0 or later*/
  174.     notCompressed                = 0,                            /*compression ID's*/
  175.     fixedCompression            = -1,                            /*compression ID for fixed-sized compression*/
  176.     variableCompression            = -2,                            /*compression ID for variable-sized compression*/
  177.     twoToOne                    = 1,
  178.     eightToThree                = 2,
  179.     threeToOne                    = 3,
  180.     sixToOne                    = 4
  181. };
  182.  
  183. enum {
  184.     stdSH                        = 0x00,                            /*Standard sound header encode value*/
  185.     extSH                        = 0xFF,                            /*Extended sound header encode value*/
  186.     cmpSH                        = 0xFE                            /*Compressed sound header encode value*/
  187. };
  188.  
  189. enum {
  190.     outsideCmpSH                = 0,                            /*MACE constants*/
  191.     insideCmpSH                    = 1,
  192.     aceSuccess                    = 0,
  193.     aceMemFull                    = 1,
  194.     aceNilBlock                    = 2,
  195.     aceBadComp                    = 3,
  196.     aceBadEncode                = 4,
  197.     aceBadDest                    = 5,
  198.     aceBadCmd                    = 6,
  199.     sixToOnePacketSize            = 8,
  200.     threeToOnePacketSize        = 16,
  201.     stateBlockSize                = 64,
  202.     leftOverBlockSize            = 32,
  203.     firstSoundFormat            = 0x0001,                        /*general sound format*/
  204.     secondSoundFormat            = 0x0002,                        /*special sampled sound format (HyperCard)*/
  205.     dbBufferReady                = 0x00000001,                    /*double buffer is filled*/
  206.     dbLastBuffer                = 0x00000004,                    /*last double buffer to play*/
  207.     sysBeepDisable                = 0x0000,                        /*SysBeep() enable flags*/
  208.     sysBeepEnable                = (1 << 0),
  209.     sysBeepSynchronous            = (1 << 1),                        /*if bit set, make alert sounds synchronous*/
  210.     unitTypeNoSelection            = 0xFFFF,                        /*unitTypes for AudioSelection.unitType*/
  211.     unitTypeSeconds                = 0x0000
  212. };
  213.  
  214.  
  215.  
  216. /* unsigned fixed-point number */
  217. typedef unsigned long UnsignedFixed;
  218.  
  219. struct SndCommand {
  220.     unsigned short                    cmd;
  221.     short                            param1;
  222.     long                            param2;
  223. };
  224. typedef struct SndCommand SndCommand;
  225.  
  226. typedef struct SndChannel SndChannel;
  227.  
  228. typedef SndChannel *SndChannelPtr;
  229.  
  230. typedef pascal void (*SndCallBackProcPtr)(SndChannelPtr chan, SndCommand *cmd);
  231.  
  232. #if GENERATINGCFM
  233. typedef UniversalProcPtr SndCallBackUPP;
  234. #else
  235. typedef SndCallBackProcPtr SndCallBackUPP;
  236. #endif
  237.  
  238. struct SndChannel {
  239.     struct SndChannel                *nextChan;
  240.     Ptr                                firstMod;                    /* reserved for the Sound Manager */
  241.     SndCallBackUPP                    callBack;
  242.     long                            userInfo;
  243.     long                            wait;                        /* The following is for internal Sound Manager use only.*/
  244.     SndCommand                        cmdInProgress;
  245.     short                            flags;
  246.     short                            qLength;
  247.     short                            qHead;
  248.     short                            qTail;
  249.     SndCommand                        queue[stdQLength];
  250. };
  251.  
  252.  
  253. /*MACE structures*/
  254. struct StateBlock {
  255.     short                            stateVar[stateBlockSize];
  256. };
  257. typedef struct StateBlock StateBlock;
  258.  
  259. typedef StateBlock *StateBlockPtr;
  260.  
  261. struct LeftOverBlock {
  262.     unsigned long                    count;
  263.     char                            sampleArea[leftOverBlockSize];
  264. };
  265. typedef struct LeftOverBlock LeftOverBlock;
  266.  
  267. typedef LeftOverBlock *LeftOverBlockPtr;
  268.  
  269. struct ModRef {
  270.     unsigned short                    modNumber;
  271.     long                            modInit;
  272. };
  273. typedef struct ModRef ModRef;
  274.  
  275. struct SndListResource {
  276.     short                            format;
  277.     short                            numModifiers;
  278.     ModRef                            modifierPart[1];            /*This is a variable length array*/
  279.     short                            numCommands;
  280.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  281.     char                            dataPart[1];                /*This is a variable length array*/
  282. };
  283. typedef struct SndListResource SndListResource;
  284.  
  285. typedef SndListResource *SndListPtr;
  286.  
  287. typedef SndListPtr *SndListHndl, *SndListHandle;
  288.  
  289. /*HyperCard sound resource format*/
  290. struct Snd2ListResource {
  291.     short                            format;
  292.     short                            refCount;
  293.     short                            numCommands;
  294.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  295.     char                            dataPart[1];                /*This is a variable length array*/
  296. };
  297. typedef struct Snd2ListResource Snd2ListResource;
  298.  
  299. typedef Snd2ListResource *Snd2ListPtr;
  300.  
  301. typedef Snd2ListPtr *Snd2ListHndl, *Snd2ListHandle;
  302.  
  303. struct SoundHeader {
  304.     Ptr                                samplePtr;                    /*if NIL then samples are in sampleArea*/
  305.     unsigned long                    length;                        /*length of sound in bytes*/
  306.     UnsignedFixed                    sampleRate;                    /*sample rate for this sound*/
  307.     unsigned long                    loopStart;                    /*start of looping portion*/
  308.     unsigned long                    loopEnd;                    /*end of looping portion*/
  309.     unsigned char                    encode;                        /*header encoding*/
  310.     unsigned char                    baseFrequency;                /*baseFrequency value*/
  311.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  312. };
  313. typedef struct SoundHeader SoundHeader;
  314.  
  315. typedef SoundHeader *SoundHeaderPtr;
  316.  
  317. struct CmpSoundHeader {
  318.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  319.     unsigned long                    numChannels;                /*number of channels i.e. mono = 1*/
  320.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  321.     unsigned long                    loopStart;                    /*loopStart of sound before compression*/
  322.     unsigned long                    loopEnd;                    /*loopEnd of sound before compression*/
  323.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  324.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  325.     unsigned long                    numFrames;                    /*length in frames ( packetFrames or sampleFrames )*/
  326.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  327.     Ptr                                markerChunk;                /*sync track*/
  328.     OSType                            format;                        /*data format type, was futureUse1*/
  329.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  330.     StateBlockPtr                    stateVars;                    /*pointer to State Block*/
  331.     LeftOverBlockPtr                leftOverSamples;            /*used to save truncated samples between compression calls*/
  332.     short                            compressionID;                /*0 means no compression, non zero means compressionID*/
  333.     unsigned short                    packetSize;                    /*number of bits in compressed sample packet*/
  334.     unsigned short                    snthID;                        /*resource ID of Sound Manager snth that contains NRT C/E*/
  335.     unsigned short                    sampleSize;                    /*number of bits in non-compressed sample*/
  336.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  337. };
  338. typedef struct CmpSoundHeader CmpSoundHeader;
  339.  
  340. typedef CmpSoundHeader *CmpSoundHeaderPtr;
  341.  
  342. struct ExtSoundHeader {
  343.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  344.     unsigned long                    numChannels;                /*number of channels,  ie mono = 1*/
  345.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  346.     unsigned long                    loopStart;                    /*same meaning as regular SoundHeader*/
  347.     unsigned long                    loopEnd;                    /*same meaning as regular SoundHeader*/
  348.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  349.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  350.     unsigned long                    numFrames;                    /*length in total number of frames*/
  351.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  352.     Ptr                                markerChunk;                /*sync track*/
  353.     Ptr                                instrumentChunks;            /*AIFF instrument chunks*/
  354.     Ptr                                AESRecording;
  355.     unsigned short                    sampleSize;                    /*number of bits in sample*/
  356.     unsigned short                    futureUse1;                    /*reserved by Apple*/
  357.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  358.     unsigned long                    futureUse3;                    /*reserved by Apple*/
  359.     unsigned long                    futureUse4;                    /*reserved by Apple*/
  360.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  361. };
  362. typedef struct ExtSoundHeader ExtSoundHeader;
  363.  
  364. typedef ExtSoundHeader *ExtSoundHeaderPtr;
  365.  
  366. struct ConversionBlock {
  367.     short                            destination;
  368.     short                            unused;
  369.     CmpSoundHeaderPtr                inputPtr;
  370.     CmpSoundHeaderPtr                outputPtr;
  371. };
  372. typedef struct ConversionBlock ConversionBlock;
  373.  
  374. typedef ConversionBlock *ConversionBlockPtr;
  375.  
  376. struct SMStatus {
  377.     short                            smMaxCPULoad;
  378.     short                            smNumChannels;
  379.     short                            smCurCPULoad;
  380. };
  381. typedef struct SMStatus SMStatus;
  382.  
  383. typedef SMStatus *SMStatusPtr;
  384.  
  385. struct SCStatus {
  386.     UnsignedFixed                    scStartTime;
  387.     UnsignedFixed                    scEndTime;
  388.     UnsignedFixed                    scCurrentTime;
  389.     Boolean                            scChannelBusy;
  390.     Boolean                            scChannelDisposed;
  391.     Boolean                            scChannelPaused;
  392.     Boolean                            scUnused;
  393.     unsigned long                    scChannelAttributes;
  394.     long                            scCPULoad;
  395. };
  396. typedef struct SCStatus SCStatus;
  397.  
  398. typedef SCStatus *SCStatusPtr;
  399.  
  400. struct AudioSelection {
  401.     long                            unitType;
  402.     UnsignedFixed                    selStart;
  403.     UnsignedFixed                    selEnd;
  404. };
  405. typedef pascal void (*FilePlayCompletionProcPtr)(SndChannelPtr chan);
  406.  
  407. #if GENERATINGCFM
  408. typedef UniversalProcPtr FilePlayCompletionUPP;
  409. #else
  410. typedef FilePlayCompletionProcPtr FilePlayCompletionUPP;
  411. #endif
  412.  
  413. enum {
  414.     uppFilePlayCompletionProcInfo = kPascalStackBased
  415.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  416. };
  417.  
  418. #if GENERATINGCFM
  419. #define NewFilePlayCompletionProc(userRoutine)        \
  420.         (FilePlayCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  421. #else
  422. #define NewFilePlayCompletionProc(userRoutine)        \
  423.         ((FilePlayCompletionUPP) (userRoutine))
  424. #endif
  425.  
  426. #if GENERATINGCFM
  427. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  428.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, (chan))
  429. #else
  430. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  431.         (*(userRoutine))((chan))
  432. #endif
  433.  
  434. typedef struct AudioSelection AudioSelection;
  435.  
  436. typedef AudioSelection *AudioSelectionPtr;
  437.  
  438. struct SndDoubleBuffer {
  439.     long                            dbNumFrames;
  440.     long                            dbFlags;
  441.     long                            dbUserInfo[2];
  442.     char                            dbSoundData[1];
  443. };
  444. typedef struct SndDoubleBuffer SndDoubleBuffer;
  445.  
  446. typedef SndDoubleBuffer *SndDoubleBufferPtr;
  447.  
  448. typedef pascal void (*SndDoubleBackProcPtr)(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  449.  
  450. #if GENERATINGCFM
  451. typedef UniversalProcPtr SndDoubleBackUPP;
  452. #else
  453. typedef SndDoubleBackProcPtr SndDoubleBackUPP;
  454. #endif
  455.  
  456. enum {
  457.     uppSndDoubleBackProcInfo = kPascalStackBased
  458.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  459.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndDoubleBufferPtr)))
  460. };
  461.  
  462. #if GENERATINGCFM
  463. #define NewSndDoubleBackProc(userRoutine)        \
  464.         (SndDoubleBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  465. #else
  466. #define NewSndDoubleBackProc(userRoutine)        \
  467.         ((SndDoubleBackUPP) (userRoutine))
  468. #endif
  469.  
  470. #if GENERATINGCFM
  471. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  472.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  473. #else
  474. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  475.         (*(userRoutine))((channel), (doubleBufferPtr))
  476. #endif
  477.  
  478. struct SndDoubleBufferHeader {
  479.     short                            dbhNumChannels;
  480.     short                            dbhSampleSize;
  481.     short                            dbhCompressionID;
  482.     short                            dbhPacketSize;
  483.     UnsignedFixed                    dbhSampleRate;
  484.     SndDoubleBufferPtr                dbhBufferPtr[2];
  485.     SndDoubleBackUPP                dbhDoubleBack;
  486. };
  487. typedef struct SndDoubleBufferHeader SndDoubleBufferHeader;
  488.  
  489. typedef SndDoubleBufferHeader *SndDoubleBufferHeaderPtr;
  490.  
  491. struct SndDoubleBufferHeader2 {
  492.     short                            dbhNumChannels;
  493.     short                            dbhSampleSize;
  494.     short                            dbhCompressionID;
  495.     short                            dbhPacketSize;
  496.     UnsignedFixed                    dbhSampleRate;
  497.     SndDoubleBufferPtr                dbhBufferPtr[2];
  498.     SndDoubleBackUPP                dbhDoubleBack;
  499.     OSType                            dbhFormat;
  500. };
  501. typedef struct SndDoubleBufferHeader2 SndDoubleBufferHeader2;
  502.  
  503. typedef SndDoubleBufferHeader2 *SndDoubleBufferHeader2Ptr;
  504.  
  505. struct SoundInfoList {
  506.     short                            count;
  507.     Handle                            infoHandle;
  508. };
  509. typedef struct SoundInfoList SoundInfoList;
  510.  
  511. typedef SoundInfoList *SoundInfoListPtr;
  512.  
  513. struct CompressionInfo {
  514.     long                            recordSize;
  515.     OSType                            format;
  516.     short                            compressionID;
  517.     unsigned short                    samplesPerPacket;
  518.     unsigned short                    bytesPerPacket;
  519.     unsigned short                    bytesPerFrame;
  520.     unsigned short                    bytesPerSample;
  521.     unsigned short                    futureUse1;
  522. };
  523. typedef struct CompressionInfo CompressionInfo;
  524.  
  525. typedef CompressionInfo *CompressionInfoPtr;
  526.  
  527. typedef CompressionInfoPtr *CompressionInfoHandle;
  528.  
  529. /* These two routines for Get/SetSoundVol should no longer be used.*/
  530. /* They were for old Apple Sound Chip machines, and do not support the DSP or PowerMacs.*/
  531. /* Use Get/SetDefaultOutputVolume instead, if you must change the user's machine.*/
  532. #if OLDROUTINENAMES && !GENERATINGCFM
  533. extern pascal void SetSoundVol(short level);
  534.  
  535. #if !GENERATINGCFM
  536. #pragma parameter GetSoundVol(__A0)
  537. #endif
  538. extern pascal void GetSoundVol(short *level)
  539.  THREEWORDINLINE(0x4218, 0x10B8, 0x0260);
  540. #endif
  541.  
  542.  
  543. extern pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  544.  ONEWORDINLINE(0xA803);
  545. extern pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  546.  ONEWORDINLINE(0xA804);
  547. extern pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  548.  ONEWORDINLINE(0xA807);
  549. extern pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  550.  ONEWORDINLINE(0xA801);
  551. extern pascal OSErr SndPlay(SndChannelPtr chan, SndListHandle sndHdl, Boolean async)
  552.  ONEWORDINLINE(0xA805);
  553. #if OLDROUTINENAMES
  554. extern pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  555.  ONEWORDINLINE(0xA802);
  556. #endif
  557. extern pascal OSErr SndControl(short id, SndCommand *cmd)
  558.  ONEWORDINLINE(0xA806);
  559.  
  560.  
  561. /* Sound Manager 2.0 and later, uses _SoundDispatch */
  562. /* SndSoundManagerVersion() returns a NumVersion*/
  563. extern pascal long SndSoundManagerVersion(void)
  564.  FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  565. extern pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  566.  FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  567. extern pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  568.  FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  569. extern pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  570.  FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  571. extern pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  572.  FOURWORDINLINE(0x203C, 0x0510, 0x0008, 0xA800);
  573. extern pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  574.  FOURWORDINLINE(0x203C, 0x0314, 0x0008, 0xA800);
  575. extern pascal void SndGetSysBeepState(short *sysBeepState)
  576.  FOURWORDINLINE(0x203C, 0x0218, 0x0008, 0xA800);
  577. extern pascal OSErr SndSetSysBeepState(short sysBeepState)
  578.  FOURWORDINLINE(0x203C, 0x011C, 0x0008, 0xA800);
  579. extern pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  580.  FOURWORDINLINE(0x203C, 0x0420, 0x0008, 0xA800);
  581.  
  582.  
  583. /* MACE compression routines */
  584. /* MACEVersion() returns a NumVersion*/
  585. extern pascal long MACEVersion(void)
  586.  FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  587. extern pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  588.  FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  589. extern pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  590.  FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  591. extern pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  592.  FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  593. extern pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  594.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  595.  
  596.  
  597. /* Sound Manager 3.0 and later calls */
  598. extern pascal OSErr GetSysBeepVolume(long *level)
  599.  FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  600. extern pascal OSErr SetSysBeepVolume(long level)
  601.  FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  602. extern pascal OSErr GetDefaultOutputVolume(long *level)
  603.  FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  604. extern pascal OSErr SetDefaultOutputVolume(long level)
  605.  FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  606. extern pascal OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long *offset)
  607.  FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  608. extern pascal UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  609.  FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  610. extern pascal OSErr GetCompressionInfo(short compressionID, OSType format, short numChannels, short sampleSize, CompressionInfoPtr cp)
  611.  FOURWORDINLINE(0x203C, 0x0710, 0x0018, 0xA800);
  612. extern pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  613.  FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  614. extern pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  615.  FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  616.  
  617.  
  618. /* Sound Manager 3.1 and later calls */
  619. extern pascal OSErr SndGetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  620.  FOURWORDINLINE(0x203C, 0x063C, 0x0018, 0xA800);
  621. extern pascal OSErr SndSetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  622.  FOURWORDINLINE(0x203C, 0x0640, 0x0018, 0xA800);
  623. extern pascal OSErr GetSoundOutputInfo(Component outputDevice, OSType selector, void *infoPtr)
  624.  FOURWORDINLINE(0x203C, 0x0644, 0x0018, 0xA800);
  625. extern pascal OSErr SetSoundOutputInfo(Component outputDevice, OSType selector, void *infoPtr)
  626.  FOURWORDINLINE(0x203C, 0x0648, 0x0018, 0xA800);
  627.  
  628.  
  629. enum {
  630.     uppSndCallBackProcInfo = kPascalStackBased
  631.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  632.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndCommand*)))
  633. };
  634.  
  635. #if GENERATINGCFM
  636. #define NewSndCallBackProc(userRoutine)        \
  637.         (SndCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  638. #else
  639. #define NewSndCallBackProc(userRoutine)        \
  640.         ((SndCallBackUPP) (userRoutine))
  641. #endif
  642.  
  643. #if GENERATINGCFM
  644. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  645.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndCallBackProcInfo, (chan), (cmd))
  646. #else
  647. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  648.         (*(userRoutine))((chan), (cmd))
  649. #endif
  650.  
  651.  
  652. #if PRAGMA_IMPORT_SUPPORTED
  653. #pragma import off
  654. #endif
  655.  
  656. #if PRAGMA_ALIGN_SUPPORTED
  657. #pragma options align=reset
  658. #endif
  659.  
  660. #ifdef __cplusplus
  661. }
  662. #endif
  663.  
  664. #endif /* __SOUND__ */
  665.